﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SimplexEngine
{
    public class Resource
    {
        internal Resource(String resource_name)
        {
            name = resource_name;
        }

        public String Name { get { return name; } }
        protected String name = "";

        internal Boolean IsReady()
        {
            return is_ready;
        }

        internal void SetReady(Boolean value)
        {
            is_ready = value;
        }
        protected Boolean is_ready = false;

        public T GetObject<T>()
        {
            UpdateQueryTime();
            return (T)data;
        }
        internal Object data = null;

        internal void SetObject(Object value)
        {
            UpdateQueryTime();
            data = value;
        }

        /// <summary>
        /// lasy query time
        /// </summary>
        internal DateTime LastQueryTime
        {
            get { return last_query_time; }
        }
        private DateTime last_query_time = DateTime.Now;
        /// <summary>
        /// update query time
        /// </summary>
        internal void UpdateQueryTime()
        {
            last_query_time = DateTime.Now;
        }

        /// <summary>
        /// time out
        /// </summary>
        public Double TimeOut
        {
            get { return time_out; }
            set { time_out = value; }
        }
        protected Double time_out = 0.0f;
    }
}
